var express = require('express');
var router = express.Router();
//表现层

const{getCarousel2,addCarousel2,getOne2,updateOne2,delCarousel2}=require("../service/carouselService")
//获取所有图片
router.get('/', async function(req, res, next) {
  res.send(await getCarousel2());
});

router.get('/:_id', async function (req, res, next) {
    res.send(await getOne2(req.params));
});

//修改图片
router.put('/',async (req,res,next)=>{
  res.send(await updateOne2(req.body));
});

//添加图片
router.post('/', async (req, res, next) => {
    res.send(await addCarousel2(req.body));
});

//删除
router.delete('/',async(req,res,next)=>{
  res.send(await delCarousel2(req.body));
});
module.exports = router;


